/*
 * Copyright 2016-2016 the original author or authors.
 * Created on 2016/12/27 下午8:12
 */
package cn.com.geasy.base;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

import java.io.Serializable;
import java.util.List;

/**
 * 请在此写下该类的说明
 *
 * @author Mechanic
 * @version 1.0
 */
public interface BaseService<T extends BaseEntity, ID extends Serializable> {

    T findOne(ID id);

    List<T> findAll();

    List<T> findAll(Sort sort);

    List<T> findAll(List<ID> ids);

    Page<T> findAll(Pageable pageable);

    //<S extends T> List<S> findAll(Example<S> example);

    //<S extends T> List<S> findAll(Example<S> example, Sort sort);

    <S extends T> List<S> save(List<S> entities);

    //<S extends T> S saveAndFlush(S entity);

    <S extends T> S save(S entity);

    long count();

    void delete(ID id);

    void delete(T entity);

    void delete(List<? extends T> entities);

    void deleteAll();

    boolean exists(ID id);

    void flush();

}
